package com.foreveross.taskservice.taskcache.domain.airfreight;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import com.foreveross.taskservice.common.model.airfreight.AirFreightQueryConditionConst;
import com.foreveross.taskservice.common.model.airfreight.AirFreightTaskModel;
import com.foreveross.taskservice.taskcache.QueryIndex;
import com.foreveross.taskservice.taskcache.TaskAddQueryIndexApplication;
/**
 * 实现查询航空运价领域的查询索引接口
 * @author guokenye
 *
 */
@Component
public class AirFreightAddQueryIndexApplicationImpl implements TaskAddQueryIndexApplication<AirFreightTaskModel>{

	@Override
	public Class<AirFreightTaskModel> getTaskModelClass() {
		return AirFreightTaskModel.class;
	}

	@Override
	public void addQueryIndex(QueryIndex query, AirFreightTaskModel model) {
		//query.put(AirFreightQueryConditionConst.CHANNELID, (double)model.getChannel().getId());
		//query.put(AirFreightQueryConditionConst.STATUS, (double)model.getStatus());
		query.put(AirFreightQueryConditionConst.CHANNELID,model.getChannel().getId()+"");
		query.put(AirFreightQueryConditionConst.STATUS, model.getStatus()+"");
		query.put(AirFreightQueryConditionConst.FROMCITYCODE, model.getFromCity());
		query.put(AirFreightQueryConditionConst.TOCITYCODE, model.getToCity());
		query.put(AirFreightQueryConditionConst.FLIGHTDATE, model.getFlightDate());
		if(StringUtils.isNotBlank(model.getReturnGrabDate()) && model.getIsReturn()==1){
			query.put(AirFreightQueryConditionConst.RETURDATE, model.getReturnGrabDate());
		}
	}

}
